<script>
import Config from "@/config/index.js";
import store from "@/store";

export default {
  onLoad() {},
  methods: {
    getUrlParam(name) {
      console.log(location);
      if (location == undefined) {
      } else {
        return (
          decodeURIComponent(
            (new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
              location.href
            ) || [, ""])[1].replace(/\+/g, "%20")
          ) || null
        );
      }
      // let _href=location.href;
      // if(_href!=null && _href!='')
      // {
      // 	var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
      // 	var r = window.location.search.substr(1).match(reg);
      // 	if (r != null) return unescape(r[2]);
      // }
      // return null;
    },
    pushHistory() {
      var state = {
        title: "title",
        url: "#",
      };
      console.log(window.history);
      if (window.history == undefined) {
      } else {
        window.history.pushState(state, "title", "#");
      }
    },
  },
  onLaunch: function () {
    uni.removeStorageSync("index_popup");
    if (wx.getPrivacySetting) {
      wx.getPrivacySetting({
        success: (res) => {
          console.log("协议显示的值", res);
        },
      });
    }
    store.commit("getSystemInfo");
    store.dispatch("wxLogin");
    store.dispatch("getRegionalConfig");

    // if (Config.isProxy) {
    //   return;
    // }
    // const code = this.getUrlParam('code');
    // const state = this.getUrlParam('state');
    // let redirect_url = encodeURIComponent('https://wzws.wanshanlundiao.cn/ServicePlatform/');
    // const wx_url =
    // 	`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${Config.appid}&redirect_uri=${redirect_url}&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`;
    // // this.pushHistory();
    // // // // window.addEventListener("popstate",function(e){
    // // // // 	window.location.href = wx_url;
    // // // // },false);
    // // 获取到token应该发送请求到后端 判断是否是注册用户
    // if (code === '' || code === null) {
    // 	const token = uni.getStorageSync('token');
    // 	if (token == '' || token == null) {
    // 		location.href = wx_url;
    // 	}
    // }
  },
  onShow: function () {},
  onHide: function () {},
};
</script>

<style lang="scss">
/*每个页面公共css */
@import "@/static/font/icon.css";
@import "@/static/font/font.css";
@import "@/static/style.css";

.container {
  min-height: 100hv;
  width: 100%;
}

page {
  font-family: "PingFang SC";
}

page,
view,
text,
navigator,
swipper,
swipper-item {
  box-sizing: border-box;
  //margin: 0;
  //padding: 0;
}

.fs30 {
  font-size: 30rpx;
}

.ftw {
  font-weight: 600;
}

.cor3 {
  color: #333;
}

.cor6 {
  color: #666;
}

.cor9 {
  color: #999;
}

/* 背景颜色 */
.appBgc {
  background-color: #e9e9e9;
}

.boxBgc {
  background-color: #f8f8f8;
}

.v-nav-bar {
  width: 100%;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  background: #fff;
}

@font-face {
  font-family: "iconfont";
  /* Project id 2690827 */
}

.iconfont {
  font-family: "iconfont" !important;
  font-size: 16px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-search6:before {
  content: "\e600";
}

._ul,
._ol {
  padding-left: 0 !important;
}

/* button{display: inline-block;padding: 0;background-color: transparent;}
	button::after {border: 0;}
	view,image {display: block;} */
</style>